<template>
    <div>

        <el-form :inline="true" :model="params" class="demo-form-inline">
            <el-form-item label="患者姓名">
                <el-input v-model="params.name" style="width: 150px"></el-input>
            </el-form-item>
            <el-form-item label="挂号日期">
                <el-col :span="11">
                    <el-date-picker type="date" placeholder="选择日期" v-model="params.createTime1" style="width: 140px;"
                                    value-format="yyyy-MM-dd"></el-date-picker>
                </el-col>
                <el-col :span="11">
                    <el-date-picker type="date" placeholder="选择日期" v-model="params.createTime2" style="width: 140px;"
                                    value-format="yyyy-MM-dd"></el-date-picker>
                </el-col>
            </el-form-item>
            <el-form-item label="状态">
                <el-select v-model="params.registrationStatus" style="width: 100px">
                    <el-option label="待就诊" value="1"></el-option>
                    <el-option label="已就诊" value="2"></el-option>
                    <el-option label="已退号" value="3"></el-option>
                    <el-option label="作废" value="4"></el-option>
                    <el-option label="未付款" value="5"></el-option>
                    <el-option label="部分支付" value="6"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="search">查询</el-button>
            </el-form-item>
        </el-form>


        <el-table
                :data="pageResult.records"
                border
                style="width: 100%">
            <el-table-column
                    label="挂号编号">
                <template slot-scope="scope">
                    {{scope.row.registrationNumber}}
                </template>
            </el-table-column>
            <el-table-column
                    label="挂号费(元)">
                <template slot-scope="scope">
                    {{scope.row.hisRegisteredfeeEntity.registeredfeeAggregateAmount}}
                </template>
            </el-table-column>
            <el-table-column
                    label="科室名称">
                <template slot-scope="scope">
                    {{scope.row.hisDepartmentEntity.departmentName}}
                </template>
            </el-table-column>
            <el-table-column
                    label="医生姓名">
                <template slot-scope="scope">
                    {{scope.row.hisDoctorEntity.trueName}}
                </template>
            </el-table-column>
            <el-table-column
                    label="患者姓名">
                <template slot-scope="scope">
                    {{scope.row.patientEntity.name}}
                </template>
            </el-table-column>
            <el-table-column
                    label="挂号时间">
                <template slot-scope="scope">
                    {{scope.row.createTime}}
                </template>
            </el-table-column>
            <el-table-column
                    label="挂号类型">
                <template slot-scope="scope">
                    {{scope.row.hisRegisteredfeeEntity.registeredfeeName}}
                </template>
            </el-table-column>
            <el-table-column
                    label="状态">
                <template slot-scope="scope">
                    {{scope.row.registrationStatus==1?'待就诊':(scope.row.registrationStatus==2?'已就诊':(scope.row.registrationStatus==3?'已退号':(scope.row.registrationStatus==4?'作废':(scope.row.registrationStatus==5?'未付款':'部分支付'))))}}
                </template>
            </el-table-column>
            <el-table-column
                    fixed="right"
                    label="操作">
                <template slot-scope="scope">
                    <div v-if="scope.row.registrationStatus==1">
                        <el-button @click="toth(scope.row.registrationId)" type="text" size="small">退号</el-button>
                        <el-button @click="tozuofei(scope.row.registrationId)" type="text" size="small">作废</el-button>
                    </div>
                    <div v-if="scope.row.registrationStatus==2">

                    </div>
                    <div v-if="scope.row.registrationStatus==3">

                    </div>
                    <div v-if="scope.row.registrationStatus==4">

                    </div>
                    <div v-if="scope.row.registrationStatus==5">
                        <el-button @click="tozhifu(scope.row.registrationId)" type="text" size="small">去支付</el-button>
                    </div>
                    <div v-if="scope.row.registrationStatus==6">

                    </div>
                </template>
            </el-table-column>
        </el-table>
        <el-footer class="case-exam-footer">
            <el-pagination
                    background
                    layout="prev, pager, next"
                    :total="pageResult.total"
                    :page-size="pageResult.size"
                    class="pagination"
                    @current-change="handleIndexChange"
            >
            </el-pagination>
        </el-footer>

        <el-dialog
                title="提示"
                :visible.sync="dialogVisible"
                width="30%">
            <payment-h-t-m-l :registrationId2="registrationId2" v-if="dialogVisible" ></payment-h-t-m-l>
        </el-dialog>

    </div>
</template>

<script>

    import PaymentHTML from './PaymentHTML.vue'


    import HisRegistration from '../../model/mfy/HisRegistration.js'
    const hisRegistration = HisRegistration.getInstance();


    export default {
        name: "HisRegistration",
        data() {
            return {
                pageResult: {},
                params: {},
                dialogVisible:false,
                registrationId2:'',
            }
        },
        methods: {
            list() {
                hisRegistration.list2(this.params).then((response) => {
                    this.pageResult = response.data.page
                })
            },
            handleIndexChange(index) {
                this.params.page = index
                this.list()
            },
            search() {
                this.params.page = 1
                this.list()
            },
            tozhifu(registrationId) {
                this.registrationId2=registrationId
                this.dialogVisible=true
            }
        },
        created() {
            this.list()
        },
        components:{
            PaymentHTML
        }
    }
</script>

<style scoped>

</style>
